<template>
  <!--------------------- 头像框 --------------------
* @auto kyle
* @date 2020-7-28
* @inrto 头像框通用组件，宽高可以更改
* @props headPortraitUrl传入的是图片地址
  -->
  <div>
    <img :src="imgSrc" alt="头像">
  </div>
</template>

<script>
export default {
  name: 'HeadPortraitBox',
  props: {
    headPortraitUrl: {
      // type: String,
      required: true,
      default: ''
    }
  },
  computed: {
    imgSrc() {
      let imgSrc = this.headPortraitUrl
      if (!imgSrc) {
        imgSrc = require('assets/images/defaultHeadPortrait.png')
      } else if (imgSrc.indexOf('http') === -1) {
        if (!this.$webInfo.ImgDomain) {
          this.$webInfo.ImgDomain = 'https://oss.hsy884.com'
        }
        imgSrc = this.$webInfo.ImgDomain + imgSrc
      }
      return imgSrc
    }
  }
}
</script>

